package auctionhausen

import static org.junit.Assert.*
import org.junit.*

class CustomerIntegrationTests {

    @Before
    void setUp() {
    }

    @After
    void tearDown() {
    }

	//C-2: Email address must be a unique field (integration test)
    @Test
    void testCustomerEmailMustBeUnique() {
		def customer1 = new Customer(email:'test@test.com', password : '123456')
		customer1.save(flush : true)
		assertFalse customer1.hasErrors()
		
		def customer2 = new Customer(email:'test@test.com', password : '123456')
		customer2.save(flush : true)
		assertEquals('unique', customer2.errors['email'].code)
    }
}
